﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    //3.定义一个图书类，存放图书的编号、书名、价格、出版社、作者信息；
    //  对价格进行赋值限制，小于0价格，赋值为0
    //  在图书类中定义一个方法输出图书信息；
    //  在主方法实例化对象，赋值并输出
    class Book
    {
        public int Id { get; set; }
        public string Title { get; set; }
        public int Price { get; set; }
        public string Press { get; set; }
        public string Writer { get; set; }

        public void book(int  id,string title,int price,string press,string writer)
        {
            this.Id = id;
            this.Title = title;
            this.Price = price;
            this.Press = press;
            this.Writer = writer;
            if (this.Price<0)
            {
                this.Price = 0;
            }
        }

        public void Test()
        {
            Console.WriteLine("编号：" + Id);
            Console.WriteLine("书名：" + Title);
            Console.WriteLine("价格：" + Price);
            Console.WriteLine("出版社：" + Press);
            Console.WriteLine("作者信息：" + Writer);


        }


    }
}
